---
title: "Vim Yes"
date: 2017
categories:
- vim
tags:
---

<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org711a61a">shortcuts</a>
<ul>
<li><a href="#org1e5de24">指定编码重新加载当前文件</a></li>
<li><a href="#org31a6020">空格代替tab</a></li>
<li><a href="#org4bc40cf">将当前编辑中的tab转空格</a></li>
<li><a href="#orgc1bf5c3">执行命令并插入命令结果</a></li>
<li><a href="#orgcb929aa">在vim中查看man</a></li>
<li><a href="#org300bad4">Tab标签页操作</a>
<ul>
<li><a href="#orgdb602e9">移动tab的位置</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-org711a61a">
<h2 id="org711a61a">shortcuts</h2>
<div class="outline-text-2" id="text-org711a61a">
</div>
<div class="outline-3" id="outline-container-org1e5de24">
<h3 id="org1e5de24">指定编码重新加载当前文件</h3>
<div class="outline-text-3" id="text-org1e5de24">
<pre class="example">
:e ++enc=gbk
</pre>
</div>
</div>
<div class="outline-3" id="outline-container-org31a6020">
<h3 id="org31a6020">空格代替tab</h3>
<div class="outline-text-3" id="text-org31a6020">
<pre class="example">
# 配置文件中
set expandtab
</pre>
</div>
</div>
<div class="outline-3" id="outline-container-org4bc40cf">
<h3 id="org4bc40cf">将当前编辑中的tab转空格</h3>
<div class="outline-text-3" id="text-org4bc40cf">
<pre class="example">
:!%retab #强制retab整个文件
</pre>
</div>
</div>
<div class="outline-3" id="outline-container-orgc1bf5c3">
<h3 id="orgc1bf5c3">执行命令并插入命令结果</h3>
<div class="outline-text-3" id="text-orgc1bf5c3">
<pre class="example">
:nr![command]
</pre>
<p>
n表示插入到第几行之后，能够不指定。
</p>
</div>
</div>
<div class="outline-3" id="outline-container-orgcb929aa">
<h3 id="orgcb929aa">在vim中查看man</h3>
<div class="outline-text-3" id="text-orgcb929aa">
<blockquote>
<p>
<a href="http://vim.wikia.com/wiki/View_man_pages_in_Vim">http://vim.wikia.com/wiki/View_man_pages_in_Vim</a>
</p>
</blockquote>
<p>
快捷键K查看man会退出当前屏幕，如果希望在vim中直接查看man则通过调用
</p>
<pre class="example">
runtime ftplugin/man.vim
</pre>
<p>
开启vim内置的man page查看插件，然后在命令模式输入 {% raw %} Man start-stop-daemon {% endraw %} 查看指定的man page。
还能绑定快捷键K： {% raw %} set keywordprg=:Man {% endraw %}
</p>
</div>
</div>
<div class="outline-3" id="outline-container-org300bad4">
<h3 id="org300bad4">Tab标签页操作</h3>
<div class="outline-text-3" id="text-org300bad4">
</div>
<div class="outline-4" id="outline-container-orgdb602e9">
<h4 id="orgdb602e9">移动tab的位置</h4>
<div class="outline-text-4" id="text-orgdb602e9">
<blockquote>
<p>
<a href="https://stackoverflow.com/questions/7961581/is-there-a-vim-command-to-relocate-a-tab">https://stackoverflow.com/questions/7961581/is-there-a-vim-command-to-relocate-a-tab</a>
</p>
</blockquote>
<p>
将当前tab移动到第i个位置：
{% raw %} :tabm i {% endraw %} (i zero-index)
将当前tab右移i位：
{% raw %} :tabm +i {% endraw %}
将当前tab左移i位：
{% raw %} :tabm -i {% endraw %}
</p>
</div>
</div>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="date">Date: 2017</p>
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
